//package io.spherelabs.manager.password
package com.gitee.wsl.struct.generator
import com.gitee.wsl.security.password.DigitRandom
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull

class DigitalRandomTest {

    private  var digitRandom: DigitRandom = Generator.DigitRandom


    @Test
    fun `check the digital random is working correctly with length 10`() {
        val random = digitRandom(10)

        println(random)

        assertEquals(10, random.length)
        assertNotNull(random)
        assertEquals(true, random.all { it.isDigit() })
        assertEquals(false, random.all { it.isLowerCase() })
    }

    @Test
    fun `check the digital random is working correctly with length 5`() {
        val random = digitRandom(5)

        println(random)

        assertEquals(5, random.length)
        assertNotNull(random)
        assertEquals(true, random.all { it.isDigit() })
        assertEquals(false, random.all { it.isLowerCase() })
    }

    @Test
    fun `check the digital random is working correctly with length 0`() {
        val random = digitRandom(5)

        println(random)

        assertEquals(5, random.length)
        assertNotNull(random)
        assertEquals(true, random.all { it.isDigit() })
        assertEquals(false, random.all { it.isLowerCase() })
    }

    @Test
    fun `gener g`(){
        val gent = Generator.primeInt(100)
        (0..10).forEach {
            println(gent())
        }
    }
}